% Generator: GNU source-highlight, by Lorenzo Bettini, http://www.gnu.org/software/src-highlite

{\ttfamily \raggedright {
\noindent
\mbox{}\textit{\textcolor{Brown}{//P\ es\ un\ polígono\ ordenado\ anticlockwise.}} \\
\mbox{}\textit{\textcolor{Brown}{//Si\ es\ clockwise,\ retorna\ el\ area\ negativa.}} \\
\mbox{}\textit{\textcolor{Brown}{//Si\ no\ esta\ ordenado\ retorna\ pura\ mierda.}} \\
\mbox{}\textit{\textcolor{Brown}{//P[0]\ !=\ P[n-1]}} \\
\mbox{}\textcolor{ForestGreen}{double}\ \textbf{\textcolor{Black}{PolygonArea}}\textcolor{BrickRed}{(}\textbf{\textcolor{Blue}{const}}\ vector\textcolor{BrickRed}{$<$}point\textcolor{BrickRed}{$>$}\ \textcolor{BrickRed}{\&}p\textcolor{BrickRed}{)}\textcolor{Red}{\{} \\
\mbox{}\ \ \textcolor{ForestGreen}{double}\ r\ \textcolor{BrickRed}{=}\ \textcolor{Purple}{0.0}\textcolor{BrickRed}{;} \\
\mbox{}\ \ \textbf{\textcolor{Blue}{for}}\ \textcolor{BrickRed}{(}\textcolor{ForestGreen}{int}\ i\textcolor{BrickRed}{=}\textcolor{Purple}{0}\textcolor{BrickRed}{;}\ i\textcolor{BrickRed}{$<$}p\textcolor{BrickRed}{.}\textbf{\textcolor{Black}{size}}\textcolor{BrickRed}{();}\ \textcolor{BrickRed}{++}i\textcolor{BrickRed}{)}\textcolor{Red}{\{} \\
\mbox{}\ \ \ \ \textcolor{ForestGreen}{int}\ j\ \textcolor{BrickRed}{=}\ \textcolor{BrickRed}{(}i\textcolor{BrickRed}{+}\textcolor{Purple}{1}\textcolor{BrickRed}{)}\ \textcolor{BrickRed}{\%}\ p\textcolor{BrickRed}{.}\textbf{\textcolor{Black}{size}}\textcolor{BrickRed}{();} \\
\mbox{}\ \ \ \ r\ \textcolor{BrickRed}{+=}\ p\textcolor{BrickRed}{[}i\textcolor{BrickRed}{].}x\textcolor{BrickRed}{*}p\textcolor{BrickRed}{[}j\textcolor{BrickRed}{].}y\ \textcolor{BrickRed}{-}\ p\textcolor{BrickRed}{[}j\textcolor{BrickRed}{].}x\textcolor{BrickRed}{*}p\textcolor{BrickRed}{[}i\textcolor{BrickRed}{].}y\textcolor{BrickRed}{;} \\
\mbox{}\ \ \textcolor{Red}{\}} \\
\mbox{}\ \ \textbf{\textcolor{Blue}{return}}\ r\textcolor{BrickRed}{/}\textcolor{Purple}{2.0}\textcolor{BrickRed}{;} \\
\mbox{}\textcolor{Red}{\}} \\

} \normalfont\normalsize
